package com.kuang.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//只要是实现了Controller接口的类，就说明它是一个控制器
public class ControllerTest1 implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView mv = new ModelAndView();
        //这个mv就做两个事情 添加数据 和 跳转到什么地方
        mv.addObject("msg","ControllerTest1");//添加数据
        mv.setViewName("test");//跳转到那里


        return mv;

    }
}
